#include "simplehighpass.h"

simplehighpass::simplehighpass(void)
{
	blur = 47;
	noise = 4;
	buffer = NULL;

}

void simplehighpass::process(IplImage* src, IplImage* des)
{

	if (buffer == NULL) {
		buffer = cvCreateImage(cvGetSize(src), src->depth, src->nChannels);
		buffer->origin = src->origin;
	}

	// create the unsharp mask using a linear average filter
	int blurParameter = blur*2+1;
	cvSmooth(src, buffer, CV_BLUR, blurParameter, blurParameter);
	cvSub(src, buffer, buffer);

	// filter out the noise using a median filter
	int noiseParameter = noise*2+1;
	cvSmooth(buffer, des, CV_BLUR, noiseParameter, noiseParameter);

}


simplehighpass::~simplehighpass(void)
{


}